package com.aaa.dem1107.d01;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/7  9:32
 */
public class Test3 {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        System.out.println("转化前的日期时间:"+now);
        DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");

        String format = now.format(dtf);
        System.out.println("转化后:"+format);
    }
}

class Test4 {
    public static void main(String[] args) {
        DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
        LocalDateTime dateTime = LocalDateTime.parse("2020/11/17 22:22:22", dtf);
        System.out.println(dateTime);
    }
}